/**
 * 项目示例-列表表头
 * Date 2023-5-25 09:33:56
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */

import type { TableColumnCtx } from "element-plus";
import { RepAcceptState } from "./utils";
interface ExampleListItem {
  project: string;
  name: string;
  startTime: string;
  endTime: string;
  user: string;
  updateTime: string;
  state: string;
  process: string;
}

export const exampleColumns = [
  { type: "index", label: "序号", width: 60, align: "center" },
  {
    prop: "repCode",
    label: "报修单号",
    sortable: true,
    minWidth: 130,
    align: "center",
  },
  {
    prop: "eqptTypeId",
    label: "设备类型",
    minWidth: 130,
    align: "center",
  },
  { prop: "problemName", label: "问题类型", minWidth: 200, align: "center" },
  {
    prop: "urgency",
    label: "紧急程度",
    minWidth: 120,
    sortable: true,
    align: "center",
    formatter: (row: any, column: any, cellValue: any) => {
      let renderText = "";
      if (cellValue == "1") renderText = "非常紧急";
      if (cellValue == "2") renderText = "一般紧急";
      if (cellValue == "3") renderText = "一般";
      return renderText;
    },
  },
  {
    prop: "creator",
    label: "上报单位",
    minWidth: 120,
    align: "center",
    formatter: (row: any, column: any, cellValue: any) => {
      return cellValue?.organName;
    },
  },
  {
    prop: "creator",
    label: "上报人",
    align: "center",
    formatter: (row: any, column: any, cellValue: any) => {
      return cellValue?.name;
    },
  },
  {
    prop: "creator",
    label: "上报人电话",
    minWidth: 180,
    align: "center",
    formatter: (row: any, column: any, cellValue: any) => {
      return cellValue?.phone;
    },
  },
  {
    prop: "lastMender",
    label: "受理单位",
    minWidth: 120,
    align: "center",
    formatter: (row: any, column: any, cellValue: any) => {
      return cellValue?.organName;
    },
  },
  {
    prop: "eqptFloor",
    label: "楼层",
    minWidth: 100,
    align: "center",
    sortable: true,
  },

  {
    prop: "createTime",
    label: "报修时间",
    sortable: true,
    width: 200,
    align: "center",
  },
  {
    prop: "repAcceptState",
    label: "状态",
    sortable: true,
    width: 120,
    align: "center",
    // formatter: (row: any, column: any, cellValue: any) => {
    //   return RepAcceptState?.[cellValue];
    // },
  },
  {
    prop: "action",
    label: "操作",
    fixed: "right",
    width: 140,
    align: "center",
  },
];
